module.exports = {
  param(field, defaultValue) {
    const rt = this.post(field) || this.get(field);
    if (rt === undefined) {
      return defaultValue;
    }
    return rt;
  },
  trimValue(field, defaultValue) {
    return this.param(field, defaultValue).trim();
  },
  intVal(field, defaultValue) {
    return parseInt(this.param(field, defaultValue));
  },
  floatVal(field, defaultValue) {
    return parseFloat(this.param(field, defaultValue));
  }
};
